import { Language } from "../../../../extend/language/Language";
type int = number;
//class RemainTimeUtil
    
    export  class RemainTimeUtil
    {
        

        public static getRemainTimeByDate(arg1: Date, arg2: Date): string
        {
            var loc2=0;
            var loc3=0;
            var loc4=0;
            var loc5=0;
            var loc6=0;
            var loc7=0;
            var loc8=0;
            var loc9=0;
            var loc1="";
            if (arg1 && arg2) 
            {
                loc2 = arg1.getDate();
                loc3 = arg1.getHours();
                loc4 = arg1.getMinutes();
                loc5 = arg1.getSeconds();
                loc6 = arg2.getDate();
                loc7 = arg2.getHours();
                loc8 = arg2.getMinutes();
                loc9 = arg2.getSeconds();
                loc1 = Language.getStringByParam(53022, loc6 - loc2, loc3 - loc7, loc4 - loc8, loc5 - loc9);
            }
            return loc1;
        }

        public static getRemainTimeBySeconds(arg1: number, arg2: Boolean=true, arg3: Boolean=true): string
        {
            var loc3=NaN;
            var loc4=0;
            var loc5=NaN;
            var loc6=0;
            var loc7=NaN;
            var loc1="";
            var loc2=0;
            if (arg1 > 0) 
            {
                loc2 = int(arg1 / secondsPerDay);
                loc3 = arg1 % RemainTimeUtil.secondsPerDay;
                loc4 = int(loc3 / secondsPerHour);
                loc5 = loc3 % RemainTimeUtil.secondsPerHour;
                loc6 = int(loc5 / 60);
                loc7 = loc5 % 60;
                if (arg3) 
                {
                    loc1 = Language.getString(53017);
                }
                if (arg2) 
                {
                    if (loc2 > 0) 
                    {
                        loc1 = loc1 + (loc2.toString() + Language.getString(53023));
                    }
                }
                loc1 = loc1 + Language.getStringByParam(53024, loc4, loc6, loc7);
            }
            return loc1;
        }

        public static getRemainMinute(arg1: number, arg2: Boolean=true, arg3: Boolean=true, arg4: Boolean=true, arg5: Boolean=true, arg6: Boolean=false): string
        {
            var loc3=NaN;
            var loc4=0;
            var loc5=NaN;
            var loc6=0;
            var loc7=NaN;
            var loc1="";
            var loc2=0;
            if (arg1 > 0) 
            {
                loc7 = (loc5 = (loc3 = arg1 % RemainTimeUtil.secondsPerDay) % RemainTimeUtil.secondsPerHour) % 60;
                loc2 = int(arg1 / secondsPerDay);
                loc4 = int(loc3 / secondsPerHour);
                loc6 = int(loc5 / 60);
                if (loc2 > 0 && arg2) 
                {
                    if (arg3 == false && loc4 > 0 && arg6) 
                    {
                        loc1 = loc1 + ((loc2 + 1).toString() + Language.getString(53023));
                    }
                    else 
                    {
                        loc1 = loc1 + (loc2.toString() + Language.getString(53023));
                    }
                }
                if (loc4 > 0 && arg3) 
                {
                    if (arg4 == false && loc6 > 0 && arg6) 
                    {
                        loc1 = loc1 + ((loc4 + 1).toString() + Language.getString(53025));
                    }
                    else 
                    {
                        loc1 = loc1 + (loc4.toString() + Language.getString(53025));
                    }
                }
                if (arg4) 
                {
                    if (arg5 == false && loc7 > 0 && arg6) 
                    {
                        loc1 = loc1 + ((loc6 + 1).toString() + Language.getString(90276));
                    }
                    else 
                    {
                        loc1 = loc1 + (loc6.toString() + Language.getString(90276));
                    }
                }
                if (arg5) 
                {
                    loc1 = loc1 + (loc7.toString() + Language.getString(90277));
                }
            }
            return loc1;
        }

        public static /* var */secondsPerDay: int=86400;

        public static /* var */secondsPerHour: int=3600;
    }

            RemainTimeUtil.secondsPerDay = 60 * 60 * 24;
            RemainTimeUtil.secondsPerHour = 60 * 60;
        